<?php /*a:2:{s:65:"D:\laragon\www\ssbeautiful\application\manage\view\users_add.html";i:1540951046;s:60:"D:\laragon\www\ssbeautiful\application\manage\view\base.html";i:1596192950;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>用户管理</span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>用户</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                            <tr>
                                <th colspan="2"><?php echo !empty($info) ? '编辑'  :  '添加'; ?>用户</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td width="15%"><label for="username">用户名称<em>*</em></label></td>
                                <td><?php if($info): ?><?php echo htmlentities($info['username']); else: ?><input type="text" class="u-ipt u-ipt-long" name="username" id="username" placeholder="请输入用户名称" value="<?php echo htmlentities($info['username']); ?>" /><span>6 位以上，可以包含数字、大小写英文字母、下划线</span><?php endif; ?></td>
                            </tr>
                            <tr>
                                <td><label for="password">密码<?php if(!$info): ?><em>*</em><?php endif; ?></label></td>
                                <td><input type="password" class="u-ipt u-ipt-long" name="password" id="password" placeholder="请输入密码" /><span>6 位以上，可以包含数字、大小写英文字母、下划线、@</span></td>
                            </tr>
                            <tr>
                                <td><label for="password_confirm">确认密码<?php if(!$info): ?><em>*</em><?php endif; ?></label></td>
                                <td><input type="password" class="u-ipt u-ipt-long" name="password_confirm" id="password_confirm" placeholder="请输入确认密码" /></td>
                            </tr>
                            <tr>
                                <td><label for="">请选择所属角色<em>*</em></label></td>
                                <td>
                                    <div class="lay-select">
                                        <select name="role_id" lay-filter="role_id">
                                            <?php if(is_array($roles) || $roles instanceof \think\Collection || $roles instanceof \think\Paginator): if( count($roles)==0 ) : echo "" ;else: foreach($roles as $key=>$role): ?>
                                            <option value="<?php echo htmlentities($role['id']); ?>"<?php if($info['role_id'] == $role['id']): ?> selected<?php endif; ?>><?php echo htmlentities($role['name']); ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">会员启用状态</label></td>
                                <td>
                                    <input type="radio" name="status" value="1" title="启用"<?php if(!$info || $info['status'] == 1): ?> checked<?php endif; ?> />
                                    <input type="radio" name="status" value="0" title="禁用"<?php if($info && $info['status'] == 0): ?> checked<?php endif; ?> />
                                </td>
                            </tr>
                            <tr>
                                <td><label for="">管理栏目</label></td>
                                <td>
                                    <div class="m-select">
                                        <select name="admin_columns[]" id="admin_columns" multiple="multiple" size="12" style="width: 320px;" lay-ignore>
                                            <?php if(is_array($columns) || $columns instanceof \think\Collection || $columns instanceof \think\Paginator): if( count($columns)==0 ) : echo "" ;else: foreach($columns as $key=>$column): ?>
                                            <option value="<?php echo htmlentities($column['id']); ?>"<?php if($info && in_array($column['id'], $info['admin_columns'])): ?> selected<?php endif; if($column['is_last']): ?> style="background: #CEE8FF;"<?php endif; ?>><?php echo htmlentities(html_entity_decode($column['html'])); ?>|-<?php echo htmlentities($column['name']); ?></option>
                                            <?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </div>
                                    <div class="m-label"><a class="u-cancel">[取消选择]</a>（选择父栏目后会自动选择子栏目）</div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>
    $(function(){
        $('.u-cancel').click(function(){
            $('#admin_columns').val('');
        });
    })
</script>

</body>
</html>